#ifndef THREADAFFINITYWIN_H
#define THREADAFFINITYWIN_H

#ifdef WIN32

#include <Windows.h>
#include "IThreadAffinity.h"

/**
 * @brief The ThreadAffinityWin class
 * Win平台线程亲和性设置
 */
class ThreadAffinityWin : public IThreadAffinity
{
public:
    virtual bool setAffinity(quint64 threadId, const QSet<int>& processorIndexs) override;

private:
    bool setAffinity(quint64 threadId, KAFFINITY mask, WORD group);
    int getActiveProcessorCount();
    int getGroupIndex(int processorIndex);
    int mapToGroupProcessorIndex(int processorIndex);
};

#endif

#endif // THREADAFFINITYWIN_H
